import urllib.request as req
import random
url = 'https://www.baidu.com/s?wd=ip'

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.26"
}
request = req.Request(url=url, headers=headers)

proxies = {
    'http': '192.168.202.221:80'
}
handler = req.ProxyHandler(proxies)
opener = req.build_opener(handler)
res = opener.open(request)
con = res.read().decode("utf-8")

with open(file='proxy.html', mode="w", encoding='utf-8') as fp:
    fp.write(con)

rad = [
    {"key": "wdawd"},
    {"key": "213"}
]
c=random.choice(rad)
print(c)